package com.wteam.controller;

import com.wteam.PoJo.DTO.buygoods;
import com.wteam.PoJo.VO.freight;
import com.wteam.PoJo.VO.refundgoods;
import com.wteam.service.OrderService;
import com.wteam.untils.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/freight")
@Slf4j
@Api(tags = "物流模块")
public class FreightController {
    @Autowired
    private OrderService orderService;

    /**
     *
     * @param freight
     * @return
     */
    @PostMapping("/listbuygoods")
    @ApiOperation(value = "查看购买的商品(可根据afterSaleStatus查)")
    public Result<List<buygoods>> listbuy(@RequestBody freight freight) {
        return orderService.selectbuygoods(freight);
    }

    /**
     *
     * @param id
     * @return
     */
    @PutMapping("/salestatus/{id}")
    @ApiOperation("确认收货（传/listbuygoods的id）")
    public Result salestatus(@PathVariable Integer id) {
        return orderService.salestatus(id);
    }

    /**
     *
     * @param refundgoods
     * @return
     */
    @PutMapping("/refundgoods")
    @ApiOperation(value = "退货")
public Result refundgoods(@RequestBody refundgoods refundgoods) {
    return orderService.refundgoods(refundgoods);
}




}
